﻿using MediatR;
using W.Device.API.Application.Command;
using W.Device.Domain;
using W.Device.Repository.Interface;

namespace W.Device.API.Application.CommandHandlder
{
    public class DeviceFanCommandHandler:IRequestHandler<DeviceFanCommand, List<DevicesInfo>>
    {
        private readonly IDeviceRepository deviceRepository;

        public DeviceFanCommandHandler(IDeviceRepository deviceRepository)
        {
            this.deviceRepository = deviceRepository;
        }

        public Task<List<DevicesInfo>> Handle(DeviceFanCommand request, CancellationToken cancellationToken)
        {
            return deviceRepository.GetAsync(w=>w.DeviceId== request.DeviceId);
        }
    }
}
